﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataAccessLayer;

namespace BusinessLogicLayer
{
    public class CT_ChucVuBLL
    {
        QuanLyChamCongDataContext DB = new QuanLyChamCongDataContext();

        public void ThemCTChucVu(CT_CHUCVU ctCV)
        {
            DB.CT_CHUCVUs.InsertOnSubmit(ctCV);
            DB.SubmitChanges();
        }

        public List<int> LayDSChucVu(int manv)
        {
            List<int> cv = (from a in DB.CT_CHUCVUs
                            where a.MaNV == manv
                            select a.MaCV).ToList();
            return cv;
        }

        public void XoaCTChucVu2(CT_CHUCVU ctcv)
        {
            DB.CT_CHUCVUs.DeleteOnSubmit(ctcv);
            DB.SubmitChanges();
        }

        public void XoaCTChucVu(int manv, int macv)
        {
            CT_CHUCVU ctcv = DB.CT_CHUCVUs.Single(a => a.MaNV == manv && a.MaCV == macv);
            DB.CT_CHUCVUs.DeleteOnSubmit(ctcv);
            DB.SubmitChanges();
        }
    }
}
